package miracle.joker.design.chain_of_responsibility;

public class FileSizeChecker implements Uploader {
    private long MAX_SIZE = 104857600;
    private Uploader next;

    public void setNext(Uploader uploader) {
        this.next = uploader;
    }

    @Override
    public void upload(File file) {
        if (file.getSize() > MAX_SIZE ) {
            System.out.println("File size is too large.");
        } else if ( file.getSize() < 0) {
            System.out.println("File size is too small.");
        } else if (next != null) {
            System.out.println("FSC");
            next.upload(file);
        } else {
            System.out.println("Upload successful.(FSC)");
        }
    }
}
